#!/usr/bin/env ruby
# SPDX-License-Identifier: MulanPSL-2.0+
# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
# frozen_string_literal: true

require 'set'
require_relative '../defconfig.rb'

start_pod

names = Set.new %w[
  ES_HOST
  ES_PORT
]

defaults = relevant_defaults(names)
ES_HOST = defaults['ES_HOST'] || '172.17.0.1'
ES_PORT = defaults['ES_PORT'] || '9200'

docker_rm 'kibana'

cmd = %W[
  docker run
  --restart=always
  --name kibana
  -v /etc/localtime:/etc/localtime:ro
  -d
  -e ELASTICSEARCH_HOSTS=http://#{ES_HOST}:#{ES_PORT}
  -p 20017:5601
  kibana:7.11.1
]

system(*cmd)
